package classfile

type ExceptionTableAttr struct {
	AttrStruct
	exceptionTableLength    uint16
	exceptionTableIndexList []uint16
	exceptionTables         []Constant
}

func (self *ExceptionTableAttr) readAttr(cp ConstantPool) AttributeInfo {
	self.exceptionTableLength = self.attributeData.ReadUInt16()
	if self.exceptionTableLength > 0 {
		self.exceptionTableIndexList = make([]uint16, self.exceptionTableLength)
		self.exceptionTables = make([]Constant, self.exceptionTableLength)
		for i := 0; i < int(self.exceptionTableLength); i++ {
			self.exceptionTableIndexList[i] = self.attributeData.ReadUInt16()
			self.exceptionTables[i] = cp.GetConstant(self.exceptionTableIndexList[i])
		}
	}
	return self
}
